<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>前置规则查询管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">企业名称</div>
                    <div class="field">
                        <input name="cstNm" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                
                <div class="fieldBox">
                    <div class="label">证件类型</div>
                    <div class="field">
                        <select name="certTypCd" id="certTypCd" ligerui="width: 160">
                            <option value=" "  selected="selected">请选择</option>
                            <option value="20" >企业统一社会信用代码</option>
                            <option value="10">中征码</option>
                        </select>
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">注册证件号码</div>
                    <div class="field">
                        <input name="certNo" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">申请人</div>
                    <div class="field">
                        <input name="cstMgrNm" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">申请时间</div>
                    <div class="field">
                        <input name="stDt" id="stDt" type="text" class="ui-datepicker" value="">
                        <span>---</span>
                        <input name="endDt" id="endDt" type="text" class="ui-datepicker" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">评审状态</div>
                    <div class="field">
                        <select name="audStsCd" id="audStsCd" data-value=" ">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${audStsCdDicList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">用户级别</div>
                    <div class="field">
                        <select name="rskLvlCd" id="rskLvlCd" data-value=" ">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${usLevelDicList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">是否复议</div>
                    <div class="field">
                        <select name="isReaud" id="isReaud" data-value=" ">
                            <option value=" " seleted>请选择</option>
                            <c:forEach items="${yesNoDicList }" var="kv">
                                <option value="${kv.key }">${kv.value }</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <%--<span id="addBtn" class="sq-button sq-button-round">新增</span>--%>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null,callback=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/corp/rccstcorpbscinfo/initList.do',
            method: 'get',
            columns: [
		{display: 'ID', name: 'id', minWidth: 130, align: 'left', enabledSort: false},
        {display: '企业名称', name: 'cstNm', minWidth: 150, align: 'left', enabledSort: false},
        {display: '证件类型', name: 'certTypCdNm', minWidth: 120, align: 'left', enabledSort: false},
        {display: '证件号码', name: 'certNo', minWidth: 166, align: 'left', enabledSort: false},
		{display: '申请人', name: 'cstMgrNm', minWidth: 80, align: 'center', enabledSort:true},
		{display: '申请时间', name: 'applyTm', minWidth: 150, align: 'center', render:renderDate, enabledSort:true},
		{display: '是否有效', name: 'isValidNm', minWidth: 50, align: 'center', enabledSort: false},
		{display: '评审结果', name: 'audStsDesc', minWidth: 100, align: 'center', enabledSort: false},
        {display: '资方评审结果', name: 'zfAduStsDesc', minWidth: 100, align: 'center', enabledSort: false,
            render: function (rowdata, rowindex, value){
                return UIUtils.showColumnTip(value);
            }
        },
		{display: '评审级别', name: 'rskLeveDesc', minWidth: 80, align: 'center', enabledSort: false},
		{display: '是否复议', name: 'isReaudNm', minWidth: 50, align: 'center', enabledSort: false},
		{display: '审批意见1', name: 'audOpinion', minWidth: 100, align: 'center', enabledSort: false},
		{display: '审批意见2', name: 'audOpinion2', minWidth: 100, align: 'center', enabledSort: false},
		{display: '附件', minWidth: 150, align: 'left', enabledSort: false,
            render: function (rowdata, rowindex, value){
                var h = '';
                var v;
                if (rowdata.fileList != null) {
                    for(var i=0;i<rowdata.fileList.length;i++){
                        v='<a href="javascript:uploadFileByUrl(';
                        v+="'"+rowdata.fileList[i].filePath+"'";
                        v+=",'"+rowdata.fileList[i].filePath+"'";
                        v+=')">'+rowdata.fileList[i].fileNm+'</a></br>';
                        h+=v;
                    }
                }
                return UIUtils.showColumnTip(h);
            }
        },
		{display: '审核状态', name: 'audStsCdNm', minWidth: 80, align: 'center', enabledSort: false},
		{display: '创建时间', name: 'crtTm', minWidth: 150, align: 'center', render:renderDate, enabledSort: false},
		{
			display: '操作',width: 150,
			render: function (rowdata, rowindex, value){
			    var v1 = '';
			    if (rowdata.audStsCd == '3') {
                    v1 = '<sys:funcAuth resCd="rcCstCorpBscInfoReaud"><a class="sq-button-hasicon" href="javascript:change(' + "'" + rowdata.id + "'," + "'" + rowdata.bsType + "'" + ',1)"><i class="sqBtnIco_4"></i>复议</a></sys:funcAuth>';
                }
                var v2 = '<sys:funcAuth resCd="rcCstCorpBscInfoShow"><a class="sq-button-hasicon" href="javascript:change(' + "'" + rowdata.id + "'," + "'" + rowdata.bsType + "'" + ',2)"><i class="sqBtnIco_4"></i>查看</a></sys:funcAuth>';
                return v1+v2;
			}
		}
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            //isScroll: false,
            checkbox: false,
            rownumbers: true,
            allowUnSelectRow: true,
            fixedCellHeight: false,
            alternatingRow: false,
            onAfterShowData : function(currentData) {
                $('.gridTip').hover(function (){
                        $(this).ligerTip({content:$(this).text(),x:10,y:10});
                    },function (){
                        $(this).ligerHideTip();
                    }
                );
            }
            /* onRenderComplete: function () {
             iframeResize ();
             } */
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });
        
        callback = function () {
            grid.reload();
        };

    });

    function change(id, bsType, zx_flag) {
        if(!id)return;

        var desc = "";
        if(zx_flag == "1") {
            desc = "复议";
        }
        if(zx_flag == "2") {
            desc = "查看";
        }

        Add_navTab("toTripartitePage"+id+"_"+zx_flag, desc, '<%=path%>/corp/rccstcorpbscinfo/toAuditPage.do?id='+id+'&zx_flag='+zx_flag);
    }

    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }

	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}
</script>

</body>
</html>
